<!DOCTYPE html>
<html lang="en" class="no-js">
<title>修复程序</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<script src="/socket.io.js"></script>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
    $(function(){
        let socket;
        let loginBtn = $("#loginBtn");
        let dissRoomBtn = $("#dissRoomBtn");
        let agreeRoomBtn = $("#agreeRoomBtn");
        let gameType;
        $("#gameType").change(function(){
            gameType = $(this).val();
            if(gameType ==1){
                socket = io("ygame-dfpk.shenghan.net.cn:32511");
            }else if(gameType==2){
                socket = io("ygame-dfmj.shenghan.net.cn");
            }else if(gameType==3){
                socket = io("101.201.34.22:32510");
            }else if(gameType ==4){
                socket = io("hb.jphgames.com:32513");
            }else if(gameType ==5){
                socket = io("ws://111.67.200.202:32510");
                
            }
            socket.on('connect', function(){
                showMsg("socket连接成功")
            });
        })
        loginBtn.click(function(){
            let userId = $("#userId").val();
            socket.emit("open", {
                userId : userId
            });
            socket.on("open_result", function(data){
                showMsg(userId+"  成功登陆")
            })
        })

        dissRoomBtn.click(function(){
            let roomId = $("#roomId").val();
            socket.emit("club_dispress", {
                roomId:roomId
            })
            socket.on("club_dispress_result", function(data){
                showMsg(JSON.stringify(data))
            })
        })
        agreeRoomBtn.click(function(){
            socket.emit("dissolve_agree", {
            })
        })
        function showMsg(msg){
            $("#showMsg").text(msg);
        }

        //强制销毁房间
        $("#clearLocation").click(function(){
            let userId=$("#uid").val();
            $.ajax({
                url : "/remove/location",
                data :{
                    userId,
                    gameType,
                },
                type:"post",
                success:function(){
                    showMsg(userId+"  清理成功")
                }
            })
        })
    })
</script>
<head>
    <style>
        body{
            width: 100%;
        }
        span{
            display: block;
            float: left;
            width: 30%;
        }
    </style>
</head>
<body>
    <div class="danyuan">
        <span>选择游戏:</span>
        <select style="width:40%;line-height: 20px;font-size: 12px;height: 25px;" id="gameType">
            <option value="1">请选择</option>
            <option value="1">大福扑克</option>
            <option value="2">大福麻将</option>
            <option value="3">桃子麻将</option>
            <option value="4">云南麻将</option>
            <option value="5">测试</option>
        </select>
    </div>
    <span>模拟用户登陆(客户端账号会被T出):</span>
    <input type="text"  placeholder="请输入需要执行权限用户ID" id="userId"><input type="button" value="登陆" id="loginBtn">
    </br>
    <span>解散房间(需要输入亲友圈管理员用户ID登陆):</span>
    <input type="text" id="roomId" placeholder="请输入房间号"><input type="button" value="解散" id="dissRoomBtn">
    <div style="width:100%;height: 50px;background: #555555;; position:fixed; left:0; bottom:0;color: white;" id="showMsg">
    </div>
    </br>
    <!-- <input type="button" value="正在解散的房间同意解散" id="agreeRoomBtn"> -->
    <span>清除用户房间信息(已经在别的房间里面强制清除)</span>
    <input type="text"  placeholder="请输入要清理的userid" id="uid">
    <input type="button" value="清理" id="clearLocation">
</body>
</html>